package edu.zjut.hjg.saas.biz.dao.impl;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import edu.zjut.hjg.saas.biz.dao.BulletinDao;
import edu.zjut.hjg.saas.biz.model.Bulletin;

public class BulletinDaoImpl extends SqlMapClientDaoSupport implements BulletinDao {

    @Override
    public Integer create(Bulletin bulletin) {
        return (Integer) getSqlMapClientTemplate().insert("bulletin.create", bulletin);
    }

    @Override
    public Bulletin findByAppId(int appId) {
        return (Bulletin) getSqlMapClientTemplate().queryForObject("bulletin.findByAppId", appId);
    }

    @Override
    public Bulletin load(Integer id) {
        return (Bulletin) getSqlMapClientTemplate().queryForObject("bulletin.load", id);
    }

    @Override
    public void update(Bulletin bulletin) {
        getSqlMapClientTemplate().update("bulletin.update", bulletin);
    }
}
